(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/ListScrollView.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '12b8bUKl/tGUJLQJo/KSbIP', 'ListScrollView', __filename);
// Script/ListScrollView.js

"use strict";

var _XmlHttpTool = require("./XmlHttpTool");

var _XmlHttpTool2 = _interopRequireDefault(_XmlHttpTool);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var rankiItem = cc.Class({
    name: 'rankiItem',
    properties: {

        rankleaveimage: cc.String,
        rankName: cc.String,
        rankheadimage: cc.Integer,
        score: cc.String

    }
});

cc.Class({
    extends: cc.Component,

    properties: {
        items: {
            default: [],
            type: rankiItem
        }, //代码几个item格子 初始化
        itemPrefab: cc.Prefab, //预制节点 代表cell内容详情
        myheadSprite: cc.Node,
        mynameLabel: cc.Label,
        myscoreLabel: cc.Label,
        mysignSprite: cc.Node,
        ListAllScrollView: cc.Node,
        RankingAllView: cc.Node,
        myrankLabel: cc.Label,
        rankCloseBtn: cc.Button,
        friendScrolView: cc.Node

    },

    onLoad: function onLoad() {},
    init: function init() {

        if (this.items.length > 0) {
            this.node.removeAllChildren();
        }

        console.log("排行榜");
        var that = this;
        _XmlHttpTool2.default.NhttpPost("/marmot/honorlist", {}, function (res) {

            console.log("好友请求成功", res);
            that.myscoreLabel.getComponent(cc.Label).string = res["user_info"]["score"];
            that.mynameLabel.getComponent(cc.Label).string = res["user_info"]["name"];

            if (res["user_info"]["user_rank"] == 1) {

                var _this2 = that;
                cc.loader.loadRes("leave_1", cc.SpriteFrame, function (err, spriteFrame) {

                    _this2.mysignSprite.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                });
            } else if (res["user_info"]["user_rank"] == 2) {

                var _this3 = that;
                cc.loader.loadRes("leave_2", cc.SpriteFrame, function (err, spriteFrame) {

                    _this3.mysignSprite.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                });
            } else if (res["user_info"]["user_rank"] == 3) {

                var _this4 = that;
                cc.loader.loadRes("leave_3", cc.SpriteFrame, function (err, spriteFrame) {

                    _this4.mysignSprite.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                });
            } else if (res["user_info"]["user_rank"] == "未上榜") {

                var _this5 = that;
                cc.loader.loadRes("未上榜", cc.SpriteFrame, function (err, spriteFrame) {

                    _this5.mysignSprite.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                });
            } else {

                var _this6 = that;
                that.myrankLabel.node.active = true;
                that.myrankLabel.getComponent(cc.Label).string = res["user_info"]["user_rank"];
                cc.loader.loadRes("排名底框", cc.SpriteFrame, function (err, spriteFrame) {

                    _this6.mysignSprite.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                });
            }
            var _this = that;
            cc.loader.load({ url: res["user_info"]["avatar"], type: 'png' }, function (err, img) {

                var mylogo = new cc.SpriteFrame(img);

                _this.myheadSprite.getComponent(cc.Sprite).spriteFrame = mylogo;

                _this.myheadSprite.width = 82;

                _this.myheadSprite.height = 82;
            });

            that.items = res["list"];
            for (var i = 0; i < that.items.length; ++i) {

                var item = cc.instantiate(that.itemPrefab);
                that.node.addChild(item);
                item.getComponent('listPrefab').init(that.items[i]);
            }
        }, function (failres) {

            console.log("好友请求错误", failres);
        });
    },
    start: function start() {},


    closeClick: function closeClick() {

        var changebig = cc.scaleTo(0.02, 1.2);

        var finish = cc.callFunc(function () {

            var that = this;
            var changesmail = cc.scaleTo(0.08, 1.0);

            var smaillfinish = cc.callFunc(function () {

                that.ListAllScrollView.active = false;
            });

            var seq2 = cc.sequence(changesmail, smaillfinish);
            this.rankCloseBtn.node.runAction(seq2);
        }, this);

        var seq = cc.sequence(changebig, finish);

        this.rankCloseBtn.node.runAction(seq);
    },

    worldListClick: function worldListClick() {},

    friendListClick: function friendListClick() {

        this.ListAllScrollView.active = false;
        this.RankingAllView.active = true;
        this.friendScrolView.getComponent("facebookScrollView").init();
    }

    // update (dt) {},
});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=ListScrollView.js.map
        